package client;

import gui.MainPanel;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import client.Client;


public class catalog implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	/**
	 * 
	 */
	
	private List<String> names = new ArrayList<String>();
	private String name;	
	private int action;
	private Item prod;
	final public static int DEFAULT_PORT = 5555;  
    private String host = "MainPanel.ip";
    private Client c;
	
	
	
	public catalog() {	
		super();
		this.c = new Client(host,DEFAULT_PORT);
	}
	/**
	 * @param prod
	 */
	public catalog(Item prod) {
		super();
		this.c = new Client(host,DEFAULT_PORT);
		this.prod = prod;
	}
	
	/**
	 * @param name
	 */
	public catalog(String name) {
		super();
		this.c = new Client(host,DEFAULT_PORT);
		this.name = name;
	}
	public catalog(List<String> names) {
		super();
		this.names = names;
	}
	public Object getAllType() {
        setAction(1); 
		c.accept(this);
         return (c.getMsg());
	}
	public Object getAllItem(){
		setAction(2); 
		c.accept(this);
        return (c.getMsg());
	}
	public Object addCatalog (){
		setAction(3); 
		c.accept(this);
        return (c.getMsg());
	}
	public Object itemDisply (){
		setAction(4); 
		c.accept(this);
        return (c.getMsg());
	}
	public Object DeleteItem (){
		setAction(5); 
		c.accept(this);
        return (c.getMsg());
	}
	public Object UpdateSale (){
		setAction(6); 
		c.accept(this);
        return (c.getMsg());
	}
	public Object AddSale (){
		setAction(7); 
		c.accept(this);
        return (c.getMsg());
	}
	public Object DeleteSale (){
		setAction(8); 
		c.accept(this);
        return (c.getMsg());
	}
	
	public void setAction(int action) {
		this.action = action;
	}
	public int getAction() {
		return action;
	}
	public void setNames(List<String> names) {
		this.names = names;
	}
	public List<String> getNames() {
		return names;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public void setProd(Item prod) {
		this.prod = prod;
	}

	public Item getProd() {
		return prod;
	}


}
